import request from '@/utils/request';
import { AxiosPromise } from 'axios';

export interface GreenWordVO extends BaseDomain {
    id: string | number;
    userId: string;
    userName: string;
    content: string;
    pass: string;
    ipAddress: string;
}

export interface GreenWordQuery extends PageQuery {
}

export interface GreenWordForm {
    id: number | string | undefined;
    userId: string;
    userName: string;
    content: string;
    pass: boolean;
    ipAddress: string;
}

// 查询
export function apiPageListGreenWord(query: GreenWordQuery): AxiosPromise<GreenWordVO[]> {
    return request({
        url: '/user/greenWord/list',
        method: 'get',
        params: query
    });
}

// 查询
export function apiGetGreenWordDetail(id: string | number): AxiosPromise<GreenWordVO> {
    return request({
        url: '/user/greenWord/info',
        method: 'get',
        params: { id }
    });
}

// 新增
export function apiAddGreenWord(data: GreenWordForm) {
    return request({
        url: '/user/greenWord/add',
        method: 'post',
        data: data
    });
}

// 修改
export function apiUpdateGreenWord(data: GreenWordForm) {
    return request({
        url: '/user/greenWord/update',
        method: 'post',
        data: data
    });
}

// 删除
export function apiRemoveGreenWord(ids: Array<string | number>) {
    return request({
        url: '/user/greenWord/remove',
        method: 'post',
        data: { ids }
    });
}
